var App = angular.module('myApp', [
    'ngAnimate',
    'ui.router',
    'ngTable',
    'ngDialog'
]);

App.run(["$rootScope", "$state", "$stateParams",  '$window', '$templateCache', 'ngTableDefaults', 
	function ($rootScope, $state, $stateParams, $window, $templateCache, ngTableDefaults) {
	
	$rootScope.$state = $state;
	$rootScope.$stateParams = $stateParams;
	$rootScope.$storage = $window.localStorage;

	$rootScope.app = {
			name: 'APP',
			username: 'king',
			man: true
	};
	
	document.onkeydown = function () {
	  
	  if (window.event && window.event.keyCode == 13) {
	    
		  window.event.returnValue = false;
	  }
	};
	
	ngTableDefaults.params.count = 5;
	ngTableDefaults.settings.counts = [5,10,20];
 
	var confirmModal = '<div class="ngdialog-message">\n'
		+ '<h4>确认删除？</h4>\n'
		+ '<div class="text-center">\n'
		+ '<button type="button" ng-click="confirm()" class="btn btn-primary">确认</button>\n'
		+ '<button type="button" ng-click="closeThisDialog()" class="btn btn-default">取消</button>\n'
		+ '</div></div>';
	$templateCache.put('confirmModal.html', confirmModal);
	
	var headerCheckbox = '<input type="checkbox" id="checkBoxAll" checkall/>';
	$templateCache.put('headerCheckbox.html', headerCheckbox);

}]);